From: Florian Müllner Date: Wed, 1 Aug 2018 11:27:07 +0000 (+0200) Subject: showOSD: Fix handling of defined 'falsy' parameters X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~929^2~3^2~33 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d908940ef37dd6a5b72148ded8b995c17a01604a;p=gnome-shell.git showOSD: Fix handling of defined 'falsy' parameters For the OSD, all parameters except for the icon are optional - if the caller doesn't include the 'label' option, the OSD won't show a label etc. While this makes sense for an API, it means that we have to be careful to correctly differentiate an option that was omitted and an option that has a 'falsy' value like false or 0. Unfortunately since commit ccaae5d3c we no longer do, with the result that OSDs meant for the first monitor will show up on all, and a level of 0 is presented as no level bar instead of an empty one, whoops. https://bugzilla.gnome.org/show_bug.cgi?id=791669 --- diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js index 55e1e5737..4d60ef45b 100644 --- a/js/ui/shellDBus.js +++ b/js/ui/shellDBus.js @@ -145,14 +145,18 @@ var GnomeShell = new Lang.Class({ for (let param in params) params[param] = params[param].deep_unpack(); - let monitorIndex = params['monitor'] || -1; - let label = params['label'] || undefined; - let level = params['level'] || undefined; - let maxLevel = params['max_level'] || undefined; + let { monitor: monitorIndex, + label, + level, + max_level: maxLevel, + icon: serializedIcon } = params; + + if (monitorIndex === undefined) + monitorIndex = -1; let icon = null; - if (params['icon']) - icon = Gio.Icon.new_for_string(params['icon']); + if (serializedIcon) + icon = Gio.Icon.new_for_string(serializedIcon); Main.osdWindowManager.show(monitorIndex, icon, label, level, maxLevel); },